<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
		<meta name="viewport" content="width=device-width, initial-scale=1"> 
		<title>页面加载特效（Page Loading Effects） | Demo 13</title>
		<meta name="description" content="页面加载特效（Page Loading Effects）: " />
		
		<meta name="author" content="Codrops" />
		<link rel="shortcut icon" href="../favicon.ico">
		<link rel="stylesheet" type="text/css" href="css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="css/demo.css" />
		<link rel="stylesheet" type="text/css" href="css/component.css" />
		<script src="js/snap.svg-min.js"></script>
		<!--[if IE]>
  		<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->
	</head>
	<body>
		<div id="pagewrap" class="pagewrap">
			<div class="container show" id="page-1">
				<header class="codrops-header">
					<h1 style="margin-top: 100px;">新页面 <span></span></h1>
				</header>
				<section class="columns clearfix">
					<div class="column">
						<nav class="codrops-demos">
							<a class="current-demo" href="index13.html">效果十三</a>
						</nav>
					</div>
					<div class="column">
						<p></p>
						<p><a id="#id3">添加点击</a></p>
						<p><a class="pageload-link" href="#page-2">点击预览效果</a></p>
					</div>
				</section>
				<div class="footer-banner" style="width:728px; margin:30px auto"></div>
			</div><!-- /container -->

			<!-- The new page dummy; this would be dynamically loaded content -->
			<div class="container" id="page-2">
				<section>
					<h2>这是一个示例页面.</h2>
					<p><a class="pageload-link" href="#page-1">返回</a></p>
				</section>
			</div><!-- /container -->

			<div id="loader" class="pageload-overlay" data-opening="m 40,-80 190,0 -305,290 C -100,140 0,0 40,-80 z">
				<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 80 60" preserveAspectRatio="none" >
					<path d="m 75,-80 155,0 0,225 C 90,85 100,30 75,-80 z"/>
				</svg>
			</div><!-- /pageload-overlay -->
			
		</div><!-- /pagewrap -->
		<script src="js/classie.js"></script>
		<script src="js/svgLoader.js"></script>
		<script>
            window.onload=function (){

                setTimeout( function() {
                    // var pageWrap = document.getElementById( 'pagewrap' ),
                    //     pages = [].slice.call( pageWrap.querySelectorAll( 'div.container' ) ),
                    //     currentPage = 0,
                    //     triggerLoading = [].slice.call( pageWrap.querySelectorAll( 'a.pageload-link' ) ),
                    //     loader = new SVGLoader( document.getElementById( 'loader' ), { speedIn : 700, easingIn : mina.easeinout }
                    loader.show();
                    setTimeout( function() {
                        loader.hide();
                        classie.removeClass( pages[ currentPage ], 'show' );
                        // update..
                        currentPage = currentPage ? 0 : 1;
                        classie.addClass( pages[ currentPage ], 'show' );
                    }, 2000 );
                }, 5000 );

            }

			(function() {
				var pageWrap = document.getElementById( 'pagewrap' ),
					pages = [].slice.call( pageWrap.querySelectorAll( 'div.container' ) ),
					currentPage = 0,
					triggerLoading = [].slice.call( pageWrap.querySelectorAll( 'a.pageload-link' ) ),
					loader = new SVGLoader( document.getElementById( 'loader' ), { speedIn : 700, easingIn : mina.easeinout } );

				function init() {
					triggerLoading.forEach( function( trigger ) {
                    // var trigger = document.getElementById( 'id3' );
						trigger.addEventListener( 'click', function( ev ) {
							ev.preventDefault();
							loader.show();
							// after some time hide loader
							setTimeout( function() {
								loader.hide();

								classie.removeClass( pages[ currentPage ], 'show' );
								// update..
								currentPage = currentPage ? 0 : 1;
								classie.addClass( pages[ currentPage ], 'show' );

							}, 2000 );
						} );
					} );
				}

				init();
			})();
		</script>
	</body>
</html>